Skip to content

Replace the objectFromEntries helper function with an objectFromMap one instead, and simplify the data lookup in the AnnotationStorage.getValue method #13081

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 12, 2021

Conversation

Snuffleupagus
Copy link
Collaborator

  • Replace the objectFromEntries helper function with an objectFromMap one instead

    Given that it's only used with Maps, and that it's currently implemented in such a way that we (indirectly) must iterate through the data twice, some simplification cannot hurt here.
    Note that the only reason that we're not using Object.fromEntries(...) directly, at each call-site, is that that one won't guarantee that a null prototype is being used.

  • Simplify the data lookup in the AnnotationStorage.getValue method

    Rather than first checking if data exists before fetching it from storage, we can simply do the lookup directly and then check its value.
    Note that this follows the same pattern as utilized in the AnnotationStorage.setValue method.

…p` one instead

Given that it's only used with `Map`s, and that it's currently implemented in such a way that we (indirectly) must iterate through the data *twice*, some simplification cannot hurt here.
Note that the only reason that we're not using `Object.fromEntries(...)` directly, at each call-site, is that that one won't guarantee that a `null` prototype is being used.
Rather than first checking if data exists before fetching it from storage, we can simply do the lookup directly and then check its value.
Note that this follows the same pattern as utilized in the `AnnotationStorage.setValue` method.
@Snuffleupagus
Copy link
Collaborator Author

/botio unittest

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_unittest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.67.70.0:8877/eea1a5344a25661/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_unittest from @Snuffleupagus received. Current queue size: 0

Live output at: http://3.101.106.178:8877/7191f5149724508/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/eea1a5344a25661/output.txt

Total script time: 3.56 mins

  • Unit Tests: FAILED

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://3.101.106.178:8877/7191f5149724508/output.txt

Total script time: 5.75 mins

  • Unit Tests: Passed

@timvandermeij timvandermeij merged commit be4a419 into mozilla:master Mar 12, 2021
@timvandermeij
Copy link
Contributor

Thanks!

@Snuffleupagus Snuffleupagus deleted the objectFromMap branch March 12, 2021 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants